<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:a="http://richfaces.org/a4j"
      xmlns:r="http://richfaces.org/rich"
      xmlns:m="http://www.caradvert.com/main">

<ui:component>

    <div class="viewAdvert">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <h:outputLink style="display:block;width:#{config.imageConfig.previewWidth}px;height:#{config.imageConfig.previewHeight}px;"
                                  value="#{ctxPath}#{advertDetailsPage}?advert=#{advert.id}" title="#{labels['DETAILS']}">
                        <h:graphicImage style="border-style:none;" rendered="#{not empty advert.images[0]}" url="#{config.imageConfig.uploadedUri}/#{advert.images[0].id}_preview.jpg"/>
                        <h:graphicImage style="border-style:none;" rendered="#{empty advert.images[0]}" url="/resources/images/car_preview.jpg"/>
                    </h:outputLink>
                </td>
                <td valign="top" width="100%;">
                    <table style="width:100%;">
                        <tr style="height:20px;font-size:7pt;font-weight:bold;vertical-align:top;color:gray;">
                            <td colspan="3" style="padding-right:5px;" class="rj">
                                <h:outputText value="#{advert.advertDate}">
                                    <f:convertDateTime pattern="dd.MM.yyyy"/>
                                </h:outputText>
                            </td>
                        </tr>
                        <tr class="cj">
                            <td style="width:200px;">
                                <table style="width:100%;padding-left:10px;">
                                    <tr>
                                        <td style="padding-bottom:15px;font-weight:bold;" class="cj">
                                            <h:panelGroup rendered="#{not empty advert.vehicle.brand}">
                                                #{advert.vehicle.brand.name} #{advert.vehicle.model.name}
                                            </h:panelGroup>
                                            <h:panelGroup rendered="#{empty advert.vehicle.brand}">
                                                #{advert.vehicle.brandName} #{advert.vehicle.modelName}
                                            </h:panelGroup>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="color:#006666;font-size:9pt;font-weight:bold;">
                                            <h:panelGroup rendered="#{not empty advert.price}">
                                                <h:outputText value="#{advert.price}" converter="currency"/> #{labels[advert.currency.name]}
                                            </h:panelGroup>
                                            <h:outputText rendered="#{empty advert.price}" value="#{labels['AGREEMENT_PRICE']}"/>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td>
                                &#160;
                            </td>
                            <td style="min-width:250px;font-size:8pt;color:dimgray;" valign="bottom">
                                <table style="width:100%;padding-right:10px;">
                                    <tr>
                                        <td class="rj oneHalf">
                                            #{labels['RELEASE_YEAR']}
                                        </td>
                                        <td style="width:20px;">-</td>
                                        <td class="lj" style="width:120px;">
                                            #{advert.vehicle.releaseYear}
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rj">
                                            #{labels['STATE']}
                                        </td>
                                        <td>-</td>
                                        <td class="lj">
                                            <h:outputText value="#{labels[advert.vehicle.state.name]}" rendered="#{not empty advert.vehicle.stateCode}"/>
                                            <h:outputText value="#{labels['NOT_SPECIFIED']}" rendered="#{empty advert.vehicle.stateCode}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rj">
                                            #{labels['REGION']}
                                        </td>
                                        <td>-</td>
                                        <td class="lj">
                                            <h:outputText value="#{labels[advert.region.name]}" rendered="#{not empty advert.regionCd}"/>
                                            <h:outputText value="#{labels['NOT_SPECIFIED']}" rendered="#{empty advert.regionCd}"/>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" class="rj" style="padding:15px 5px 0 0;font-size:8pt;font-weight:bold;">
                                <h:outputLink value="#{ctxPath}#{advertDetailsPage}?advert=#{advert.id}">
                                    #{labels['DETAILS']} >>
                                </h:outputLink>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>

</ui:component>
</html>